<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
		<canvas id="canvas" style="border: 1px solid red;"></canvas>
		<script type="text/javascript">
			window.onload = function() {
//				document.onclick = function(e) {
//					console.log(e.clientX);
//					console.log(e.clientY);
//				}
				var canvas=document.getElementById("canvas");
				var cxt=canvas.getContext("2d");
				canvasx=canvas.getBoundingClientRect().left//返回canvas距离左边的距离
				canvasy=canvas.getBoundingClientRect().top//返回canvas距离上边的距离
//				console.log(canvasx)
//				console.log(canvas)
				

			}
		</script>
	</body>

</html>